package com.milo.utils;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Auther: Milogenius
 * @Date: 2018/7/30 22:43
 * @Description:日期工具类
 */
public class DateUtils {

    /**
     * 获取当前时间
     * @return
     */
    public static  Date getNowDate(){
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm;ss");
        String dateString = formatter.format(currentTime);
        ParsePosition pos = new ParsePosition(0);
        Date currentTime_2 = formatter.parse(dateString, pos);
        return currentTime_2;
    }

    public static void main(String[] args) {
        //Mon Jul 30 23:01:08 CST 2018
        //Sat Jul 30 23:02:05 CST 18
        //Sat Jul 30 23:02:26 CST 18
        //Mon Jul 30 23:02:49 CST 8


        System.out.println(getNowDate());
    }
}
